import Taro from '@tarojs/taro'
import { getCategoryById } from './service';

export default {

  namespace: 'listDetails',

  state: {},

  effects: {
    * init({payload:id}, { call, put }) {
      console.log('home effects id',id);
      console.log(typeof(id));
      const details = yield call(getCategoryById,id);
      console.log('home effects details',details);
      yield put({
        type:'save',
        payload: {
          details:details.list,
        },
      });
    },

  },

  reducers: {
    save(state, { payload }) {
      console.log('home effects payload',payload);
      return {
        ...state,
        ...payload
      };
    },
  },
};
